package edu.zu.dao;

import edu.zu.pojo.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * 数据层接口
 */
@Mapper
public interface UserInfoMapper {

    List<UserInfo> queryInfos();

    UserInfo queryById(Integer id);

    /**
     * 参数多个时，可以使用@Param("value")进行参数的手动绑定，此时要求xml中对应的sql里面#{value}
     */
    UserInfo queryByEmailAndPsw(@Param("mail") String email, @Param("psw") String password);

    UserInfo queryByCondition(UserInfo userInfo);

    List<UserInfo> queryByMap(Map<String,Object> map);

    int deleteById(Integer id);

    int updateEmailById(UserInfo userInfo);

    int insertInfo(UserInfo userInfo);

    @Select("select * from user_info where username like concat('%',#{name},'%')")
    List<UserInfo> queryLikeName(String name);

    @Select("select * from user_info")
    List<UserInfo> queryList();

    List<UserInfo> queryByCondition2(UserInfo userInfo);

    int updateByCondition(UserInfo userInfo);

    int deleteByCondition(UserInfo userInfo);

    List<UserInfo> queryByIds(List<Integer> ids);

    List<UserInfo> queryUserItemsInfos();


    UserInfo selectInfoById(Integer id);

}
